﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class 参保_list : System.Web.UI.Page
{
   
    protected void Page_Load(object sender, EventArgs e)
    {
        
    }
    protected void LinkButton2_Click(object sender, EventArgs e)
    {
        
    }
    protected void LinkButton2_Command(object sender, CommandEventArgs e)
    {
        缴费表dao d = new 缴费表dao();
        string pid = e.CommandArgument.ToString();
        d.DeleteByPersonId(pid);
    }
    protected void GridView1_DataBound(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (String.IsNullOrEmpty(Request.QueryString.Get("pageIndex")))
            {
                this.GridView1.PageIndex = 0;
            }
            else
            {
                this.GridView1.PageIndex = Convert.ToInt32(Request.QueryString.Get("pageIndex"));
            }


        }
    }

    protected void SqlDataSource1_Init(object sender, EventArgs e)
    {
         string order, name;
        try
        {
            order = Request.QueryString.Get("order").ToString();
            name = Request.QueryString.Get("name").ToString();
            byte[] bytes = System.Text.Encoding.GetEncoding("GB2312").GetBytes(order);
            order = System.Text.Encoding.GetEncoding("GB2312").GetString(bytes);

            

            if (!String.IsNullOrEmpty(order))
            {
                if (order.Equals("cbzt"))//显示全部新参保人员
                    SqlDataSource1.SelectCommand = "SELECT * FROM [缴费人员表] where " + order + " like '%" + name + "%'"; 
                else if(order.Equals("code"))//显示特定资金账户的所有新参保人员
                {
                    SqlDataSource1.SelectCommand = "SELECT * FROM [缴费人员表] WHERE (cbzt like '新参保' and personId IN (SELECT DISTINCT personId FROM 缴费表 WHERE (code = '" + name + "')))";
                }
                else
                    SqlDataSource1.SelectCommand = "SELECT * FROM [缴费人员表] where " + order + " ='" + name + "'";
                   
            }
        }
        catch (Exception exp) { }
    }
    
}
